package com.sc.nft.service.impl;

import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.dao.ActivityAwardDao;
import com.sc.nft.dao.AppPackageManageDao;
import com.sc.nft.entity.ActivityAward;
import com.sc.nft.entity.AppPackageManage;
import com.sc.nft.entity.dto.ActivityAwardSaveDTO;
import com.sc.nft.entity.dto.ActivityCouponsDTO;
import com.sc.nft.entity.vo.AppPackageManageGetByNameVO;
import com.sc.nft.entity.vo.appPackageManage.AppPackManageAdminPageVO;
import com.sc.nft.enums.CouponsStatusEnum;
import com.sc.nft.exception.GlobalRunTimeException;
import com.sc.nft.service.ActivityAwardService;
import com.sc.nft.service.AppPackageManageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.implementation.bytecode.Throw;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * (AppPackageManage)表服务实现类
 *
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class AppPackageManageServiceImpl implements AppPackageManageService {

    private final AppPackageManageDao appPackageManageDao;

    @Override
    public IPage<AppPackManageAdminPageVO> adminPage(String name, Integer pageNo, Integer pageSize) {
        return appPackageManageDao.adminPage(name,pageNo,pageSize);
    }


    /**
     * 开启
     *
     * @param id
     */
    @Override
    public void enable(Long id) {
        appPackageManageDao.updateButton(id,Boolean.TRUE);
    }

    /**
     * 关闭
     *
     * @param id
     */
    @Override
    public void disable(Long id) {
        appPackageManageDao.updateButton(id,Boolean.FALSE);
    }

    /**
     * 前台根据渠道名称查询是否开启
     *
     * @param sourcePackageName
     * @return
     */
    @Override
    public AppPackageManageGetByNameVO getByName(String sourcePackageName) {
        return appPackageManageDao.getByName(sourcePackageName);
    }
}
